<!--#Include File="Include.asp"--><%
'--------------------------------------
'Power By 方卡在线 @2010-2014 f02
'URL:http://www.fangka.net/
'EMail:admin@ifangka.com
'QQ:861118936
'版权所有 未经允许不得去除本版权信息
'--------------------------------------

Call CheckAdminType("0,1",UType)
Call CheckAdminLimit(ULimit,"o_Model",0)

Dim Fk_Model_Name,Fk_Model_ViewName,Fk_Model_Type,Fk_Model_Default,Fk_Model_Field,Fk_Model_State,Fk_Model_Template,Fk_Model_LowTemplate
Dim Fk_Model_GoUrl,Fk_Model_Succeed,Fk_Model_Repeat,Fk_Model_NoTrash,Fk_Model_TrashPint,Fk_Model_MinStr,Fk_Model_MaxStr,Fk_Model_Captchas
Dim Field_Name,Field_Remark,Field_Label,Field_Help,Field_Type,Field_Option,Field_TypeName,Field_StrMin,Field_StrMax,Field_ListShow
Dim TemplateSelect

Types=Clng(Request.QueryString("Type"))

Select Case Types
	Case 1
		Call ModelList() '模型列表
	Case 2
		Call ModelAddForm() '添加模型表单
	Case 3
		Call ModelAddDo() '执行添加模型
	Case 4
		Call ModelEditForm() '修改模型表单
	Case 5
		Call ModelEditDo() '执行修改模型
	Case 6
		Call ModelDelDo() '执行删除模型
	Case 7
		Call ModelCopyDo() '执行复制模型
	Case 12
		Call GBookModelAddForm() '添加留言模型表单
	Case 13
		Call GBookModelAddDo() '执行添加留言模型
	Case 14
		Call GBookModelEditForm() '修改留言模型表单
	Case 15
		Call GBookModelEditDo() '执行修改留言模型
	Case Else
		Call FKFun.ShowErr("未发现功能项！",1)
End Select

'==========================================
'函 数 名：ModelList()
'作    用：模型列表
'==========================================
Sub ModelList()
%>
		<div id="rightNav">
			<ul>
				<li><a href="Model.asp?Type=2" target="dialog" width="800">添加内容模型</a></li>
				<li><a href="Model.asp?Type=12" target="dialog" width="800">添加留言模型</a></li>
			</ul>
		</div>
		<div id="searchLine" class="font_bold">
			模型管理
		</div>
		<table width="100%" bordercolor="#CCCCCC" border="1" cellspacing="0" cellpadding="0">
			<tr>
				<th align="center">序号</th>
				<th align="center">名称</th>
				<th align="center">显示名称</th>
				<th align="center">类型</th>
				<th align="center">是否可用</th>
				<th align="center">操作</th>
			</tr>
<%
	Sqlstr="Select Fk_Model_Id,Fk_Model_Name,Fk_Model_ViewName,Fk_Model_Type,Fk_Model_State From [Fk_Model] Order By Fk_Model_Id Asc"
	Rs.Open Sqlstr,Conn,1,1
	If Not Rs.Eof Then
		i=1
		While Not Rs.Eof
%>
			<tr>
				<td height="20" align="center"><%=i%></td>
				<td align="center"><%=Rs("Fk_Model_Name")%></td>
				<td align="center"><%=Rs("Fk_Model_ViewName")%></td>
				<td align="center"><%=FKFun.GetModelTypeName(Rs("Fk_Model_Type"))%></td>
				<td align="center"><%=FKFun.GetStateName(Rs("Fk_Model_State"))%></td>
				<td align="center"><a href="Model.asp?Type=<%If Rs("Fk_Model_Type")=3 Then%>14<%Else%>4<%End If%>&Id=<%=Rs("Fk_Model_Id")%>" target="dialog" width="800">修改</a> <a href="Model.asp?Type=7&Id=<%=Rs("Fk_Model_Id")%>" target="delete" confirmStr="您确认要复制“<%=Rs("Fk_Model_Name")%>”？" refreshUrl="Model.asp?Type=1" showStr="模型复制成功！">复制</a> <a href="Model.asp?Type=6&Id=<%=Rs("Fk_Model_Id")%>" target="delete" confirmStr="您确认要删除“<%=Rs("Fk_Model_Name")%>”？此操作不可逆！" refreshUrl="Model.asp?Type=1" showStr="模型删除成功！">删除</a></td>
			</tr>
<%
			Rs.MoveNext
			i=i+1
		Wend
	Else
%>
			<tr>
				<td height="25" colspan="20" align="center">暂无记录</td>
			</tr>
<%
	End If
	Rs.Close
%>
			<tr>
				<td height="30" colspan="20">&nbsp;</td>
			</tr>
		</table>
		<div id="rightBottom">
		
		</div>
<%
End Sub

'==========================================
'函 数 名：ModelAddForm()
'作    用：添加内容模型表单
'==========================================
Sub ModelAddForm()
	Sqlstr="Select Fk_Template_Name From [Fk_Template] Where (Fk_Template_Name Like 'm_%%' Or Fk_Template_Name Like '%%/m_%%') Order By Fk_Template_Id Asc"
	Rs.Open Sqlstr,Conn,1,1
	While Not Rs.Eof
		If Instr(Rs("Fk_Template_Name"),"/")>0 Then
			TempArr=Split(Rs("Fk_Template_Name"),"/")
			Temp=","&TempArr(UBound(TempArr))&","
		Else
			Temp=","&Rs("Fk_Template_Name")&","
		End If
		If Instr(DisTemplate,Temp)=0 Then
			If TemplateSelect="" Then
				TemplateSelect=Rs("Fk_Template_Name")
			Else
				TemplateSelect=TemplateSelect&",,"&Rs("Fk_Template_Name")
			End If
		End If
		Rs.MoveNext
	Wend
	Rs.Close
%>
<form id="ModelAdd" name="ModelAdd" method="post" target="ajax" action="Model.asp?Type=3" showStr="新模型添加成功！" refreshUrl="Model.asp?Type=1" boxClose="1">
<div id="title">添加新内容模型</div>
<div id="box">
	<table width="90%" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td width="15%" height="30" align="right">名称：</td>
			<td width="85%">&nbsp;<input name="Fk_Model_Name" type="text" class="input" id="Fk_Model_Name" /><span class="help" title="<p>模型名称，请输入1-50个字符（两个字符为一个汉字）。</p>"></span></td>
		</tr>
		<tr class="m_View">
			<td height="30" align="right">显示名称：</td>
			<td>&nbsp;<input name="Fk_Model_ViewName" type="text" class="input" id="Fk_Model_ViewName" /><span class="help" title="<p>模型内容页显示的名称，请输入1-50个字符（两个字符为一个汉字）。</p>"></span></td>
		</tr>
		<tr>
			<td height="30" align="right">类型：</td>
            <td>&nbsp;<select class="input" name="Fk_Model_Type" id="Fk_Model_Type" onchange="ModelTypeChange($(this).val());">
					<option value="1">列表</option>
					<option value="2">信息</option>
				</select><span class="help" title="<p>模型类型。</p>"></span>
			</td>
		</tr>
		<tr id="m_Template">
			<td height="30" align="right">显示模板：</td>
            <td>&nbsp;<select class="input" name="Fk_Model_Template" id="Fk_Model_Template">
					<option value="">默认模板</option>
<%
	TempArr=Split(TemplateSelect,",,")
	For Each Temp In TempArr
%>
					<option value="<%=Temp%>"><%=Temp%></option>
<%
	Next
%>
				</select><span class="help" title="<p>选择显示模板。</p>"></span>
			</td>
		</tr>
		<tr id="m_List">
			<td height="30" align="right">子内容模板：</td>
            <td>&nbsp;<select class="input" name="Fk_Model_LowTemplate" id="Fk_Model_LowTemplate">
					<option value="">默认模板</option>
<%
	TempArr=Split(TemplateSelect,",,")
	For Each Temp In TempArr
%>
					<option value="<%=Temp%>"><%=Temp%></option>
<%
	Next
%>
				</select><span class="help" title="<p>选择子内容模板。</p>"></span>
			</td>
		</tr>
		<tr>
			<td height="30" align="right">是否可用：</td>
            <td>&nbsp;<input type="radio" name="Fk_Model_State" class="input" id="Fk_Model_State" value="0" />不可用
				<input type="radio" name="Fk_Model_State" class="input" id="Fk_Model_State" value="1" checked="checked" />可用<span class="help" title="<p>不可用的模型在菜单项配置里不可见。</p>"></span>
			</td>
		</tr>
		<tr class="m_View">
			<td height="30" align="right">基础项：</td>
            <td>&nbsp;<input type="checkbox" name="Fk_Model_Default" class="input" id="Fk_Model_Default" value="1" checked="checked" />题图&nbsp;&nbsp;
				<input type="checkbox" name="Fk_Model_Default" class="input" id="Fk_Model_Default" value="2" checked="checked" />文件名&nbsp;&nbsp;
				<span class="help" title="<p>选择模型基础项，标题、内容等项为必选，此处不显示。</p>"></span>
			</td>
		</tr>
	</table>
	<p id="FieldList">&nbsp;</p>
	<table width="90%" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
	    <tr>
	        <td height="30" width="15%" align="right">名称：</td>
	        <td width="85%">&nbsp;<input name="Field_Name" type="text" class="input" id="Field_Name" size="40" /><span class="help" title="<p>自定义字段名称，请输入1-50个字符（两个字符为一个汉字）。</p>"></span></td>
	    </tr>
	    <tr>
	        <td height="30" align="right">备注：</td>
	        <td>&nbsp;<input name="Field_Remark" type="text" class="input" id="Field_Remark" size="40" /><span class="help" title="<p>用于识别自定义字段的用途，此段文字仅显示在自定义字段列表上，请输入1-255个字符（两个字符为一个汉字）。</p>"></span></td>
	    </tr>
        <tr>
            <td height="30" align="right">字段标识：</td>
            <td>&nbsp;<input name="Field_Label" type="text" class="input" id="Field_Label" size="20" /><span class="help" title="<p>自定义字段标识，配置后请尽量不要修改，请输入字母或数字，请输入1-50个字符。</p>"></span></td>
        </tr>
	    <tr>
	        <td height="30" align="right">帮助语句：</td>
	        <td>&nbsp;<input name="Field_Help" type="text" class="input" id="Field_Help" size="40" /><span class="help" title="<p>帮助语句，显示在输入框边上，请输入1-255个字符（两个字符为一个汉字）。</p>"></span></td>
	    </tr>
        <tr>
            <td height="30" align="right">输入类型：</td>
            <td>&nbsp;<select name="Field_Type" class="input" id="Field_Type" onchange="if($(this).val()==3){$('#Option').show();}else{$('#Option').hide();}">
                    <option value="0">文本框</option>
                    <option value="1">编辑器框</option>
                    <option value="2">上传框</option>
                    <option value="3">下拉框</option>
            </select><span class="help" title="<p>选择输入类型。</p>"></span></td>
        </tr>
        <tr id="Option" class="dis">
            <td height="30" align="right">选项：</td>
            <td>&nbsp;<textarea name="Field_Option" class="textarea" cols="60" rows="5" id="Field_Option"></textarea><span class="help" title="<p>选项每行一个：选项值||选项字符串。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">&nbsp;</td>
            <td>&nbsp;<input type="button" class="button" name="btn1" id="btn1" value="增加字段" onclick="AddField();" /></td>
        </tr>
	</table>
</div>
<div id="bottom">
	<input type="submit" class="button" name="Enter" id="Enter" value="添 加" />
	<input type="button" onclick="dialogClose();" class="button" name="button" id="button" value="关 闭" />
</div>
</form>
<%
End Sub

'==============================
'函 数 名：ModelAddDo
'作    用：执行添加内容模型
'==============================
Sub ModelAddDo()
	Fk_Model_Name=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_Name")))
	Fk_Model_ViewName=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_ViewName")))
	Fk_Model_Template=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_Template")))
	Fk_Model_LowTemplate=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_LowTemplate")))
	Fk_Model_Default=FKFun.HTMLEncode(Replace(Trim(Request.Form("Fk_Model_Default"))," ",""))
	Fk_Model_Field=FKFun.HTMLEncode(Replace(Trim(Request.Form("Fk_Model_Field")),", ",""))
	Fk_Model_Type=Trim(Request.Form("Fk_Model_Type"))
	Fk_Model_State=Trim(Request.Form("Fk_Model_State"))
	Fk_Model_Field=Replace(Fk_Model_Field,"<br />","|-|")
	Call FKFun.JsonString(Fk_Model_Name,1,50,0,"请输入名称！","名称不能大于50个字符！")
	Call FKFun.JsonNum(Fk_Model_Type,"请选择模型类型！")
	Call FKFun.JsonNum(Fk_Model_State,"请选择是否可用！")
	If Instr("2",Fk_Model_Type)>0 Then
		Fk_Model_Default=",,"
		Fk_Model_ViewName="-"
	End If
	Fk_Model_Default=","&Fk_Model_Default&","
	Sqlstr="Select Fk_Model_Id,Fk_Model_Name,Fk_Model_ViewName,Fk_Model_Type,Fk_Model_Template,Fk_Model_LowTemplate,Fk_Model_Default,Fk_Model_Field,Fk_Model_State From [Fk_Model] Where Fk_Model_Name='"&Fk_Model_Name&"'"
	Rs.Open Sqlstr,Conn,1,3
	If Rs.Eof Then
		Application.Lock()
		Rs.AddNew()
		Rs("Fk_Model_Name")=Fk_Model_Name
		Rs("Fk_Model_ViewName")=Fk_Model_ViewName
		Rs("Fk_Model_Type")=Fk_Model_Type
		Rs("Fk_Model_Template")=Fk_Model_Template
		Rs("Fk_Model_LowTemplate")=Fk_Model_LowTemplate
		Rs("Fk_Model_Default")=Fk_Model_Default
		Rs("Fk_Model_Field")=Fk_Model_Field
		Rs("Fk_Model_State")=Fk_Model_State
		Rs.Update()
		Application.UnLock()
		Call FKFun.JsonSuccess()
	Else
		Rs.Close
		Call FKFun.JsonError("该模型名称已经被占用！")
	End If
	Rs.Close
End Sub

'==========================================
'函 数 名：ModelEditForm()
'作    用：修改内容模型表单
'==========================================
Sub ModelEditForm()
	Id=Clng(Request.QueryString("Id"))
	Sqlstr="Select Fk_Model_Name,Fk_Model_ViewName,Fk_Model_Type,Fk_Model_Template,Fk_Model_LowTemplate,Fk_Model_Default,Fk_Model_Field,Fk_Model_State From [Fk_Model] Where Fk_Model_Id=" & Id
	Rs.Open Sqlstr,Conn,1,1
	If Not Rs.Eof Then
		Fk_Model_Name=Rs("Fk_Model_Name")
		Fk_Model_ViewName=Rs("Fk_Model_ViewName")
		Fk_Model_Type=Rs("Fk_Model_Type")
		Fk_Model_Template=Rs("Fk_Model_Template")
		Fk_Model_LowTemplate=Rs("Fk_Model_LowTemplate")
		Fk_Model_Default=Rs("Fk_Model_Default")
		Fk_Model_Field=Rs("Fk_Model_Field")
		Fk_Model_State=Rs("Fk_Model_State")
		If IsNull(Fk_Model_Field) Then
			Fk_Model_Field=""
		End If
		Fk_Model_Field=Replace(Fk_Model_Field,"|FieldList|,","|FieldList|")
	Else
		Rs.Close
		Call FKFun.ShowErr("模型不存在！",1)
	End If
	Rs.Close
	
	Sqlstr="Select Fk_Template_Name From [Fk_Template] Where (Fk_Template_Name Like 'm_%%' Or Fk_Template_Name Like '%%/m_%%') Order By Fk_Template_Id Asc"
	Rs.Open Sqlstr,Conn,1,1
	While Not Rs.Eof
		If Instr(Rs("Fk_Template_Name"),"/")>0 Then
			TempArr=Split(Rs("Fk_Template_Name"),"/")
			Temp=","&TempArr(UBound(TempArr))&","
		Else
			Temp=","&Rs("Fk_Template_Name")&","
		End If
		If Instr(DisTemplate,Temp)=0 Then
			If TemplateSelect="" Then
				TemplateSelect=Rs("Fk_Template_Name")
			Else
				TemplateSelect=TemplateSelect&",,"&Rs("Fk_Template_Name")
			End If
		End If
		Rs.MoveNext
	Wend
	Rs.Close
%>
<form id="ModelEdit" name="ModelEdit" method="post" target="ajax" action="Model.asp?Type=5" showStr="模型修改成功！" refreshUrl="Model.asp?Type=1" boxClose="1">
<div id="title">修改内容模型</div>
<div id="box">
	<table width="90%" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td width="24%" height="30" align="right">名称：</td>
			<td width="76%">&nbsp;<input name="Fk_Model_Name" type="text" class="input" id="Fk_Model_Name" value="<%=Fk_Model_Name%>" /><span class="help" title="<p>模型名称，请输入1-50个字符（两个字符为一个汉字）。</p>"></span></td>
		</tr>
		<tr class="m_View<%If Instr("2",Fk_Model_Type)>0 Then%> dis<%End If%>">
			<td height="30" align="right">显示名称：</td>
			<td>&nbsp;<input name="Fk_Model_ViewName" type="text" class="input" id="Fk_Model_ViewName" value="<%=Fk_Model_ViewName%>" /><span class="help" title="<p>模型内容页显示的名称，请输入1-50个字符（两个字符为一个汉字）。</p>"></span></td>
		</tr>
		<tr>
			<td height="30" align="right">类型：</td>
            <td>&nbsp;<select class="input" name="Fk_Model_Type" id="Fk_Model_Type" onchange="ModelTypeChange($(this).val());">
					<option value="1"<%=FKFun.BeSelect(Fk_Model_Type,1)%>>列表</option>
					<option value="2"<%=FKFun.BeSelect(Fk_Model_Type,2)%>>信息</option>
				</select><span class="help" title="<p>模型类型。</p>"></span>
			</td>
		</tr>
		<tr id="m_Template">
			<td height="30" align="right">显示模板：</td>
            <td>&nbsp;<select class="input" name="Fk_Model_Template" id="Fk_Model_Template">
					<option value="">默认模板</option>
<%
	TempArr=Split(TemplateSelect,",,")
	For Each Temp In TempArr
%>
					<option value="<%=Temp%>"<%=FKFun.BeSelect(Fk_Model_Template,Temp)%>><%=Temp%></option>
<%
	Next
%>
				</select><span class="help" title="<p>选择显示模板。</p>"></span>
			</td>
		</tr>
		<tr id="m_List" class="m_View<%If Instr("2",Fk_Model_Type)>0 Then%> dis<%End If%>">
			<td height="30" align="right">子内容模板：</td>
            <td>&nbsp;<select class="input" name="Fk_Model_LowTemplate" id="Fk_Model_LowTemplate">
					<option value="">默认模板</option>
<%
	TempArr=Split(TemplateSelect,",,")
	For Each Temp In TempArr
%>
					<option value="<%=Temp%>"<%=FKFun.BeSelect(Fk_Model_LowTemplate,Temp)%>><%=Temp%></option>
<%
	Next
%>
				</select><span class="help" title="<p>选择子内容模板。</p>"></span>
			</td>
		</tr>
		<tr>
			<td height="30" align="right">是否可用：</td>
            <td>&nbsp;<input type="radio" name="Fk_Model_State" class="input" id="Fk_Model_State" value="0"<%=FKFun.BeCheck(Fk_Model_State,0)%> />不可用
				<input type="radio" name="Fk_Model_State" class="input" id="Fk_Model_State" value="1"<%=FKFun.BeCheck(Fk_Model_State,1)%> />可用<span class="help" title="<p>不可用的模型在菜单项配置里不可见。</p>"></span>
			</td>
		</tr>
		<tr class="m_View<%If Instr("2",Fk_Model_Type)>0 Then%> dis<%End If%>">
			<td height="30" align="right">基础项：</td>
            <td>&nbsp;<input type="checkbox" name="Fk_Model_Default" class="input" id="Fk_Model_Default" value="1"<%If Instr(Fk_Model_Default,",1,")>0 Then%> checked="checked"<%End If%> />题图&nbsp;&nbsp;
				<input type="checkbox" name="Fk_Model_Default" class="input" id="Fk_Model_Default" value="2"<%If Instr(Fk_Model_Default,",2,")>0 Then%> checked="checked"<%End If%> />文件名&nbsp;&nbsp;
				<span class="help" title="<p>选择模型基础项，标题、内容等项为必选，此处不显示。</p>"></span>
			</td>
		</tr>
	</table>
<%
	TempArr=Split(Fk_Model_Field,"|FieldList|")
	Response.Write("<script type=""text/javascript"">")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Name=FKFun.GetSub(Temp,"Field_Name:","|;|","")
			Field_Remark=FKFun.GetSub(Temp,"Field_Remark:","|;|","")
			Field_Label=FKFun.GetSub(Temp,"Field_Label:","|;|","")
			Field_Help=FKFun.GetSub(Temp,"Field_Help:","|;|","")
			Field_Type=FKFun.GetSub(Temp,"Field_Type:","|;|","")
			Field_Option=FKFun.GetSub(Temp,"Field_Option:","|;|","")
			Response.Write("AddField_Show('"&Field_Name&"','"&Field_Remark&"','"&Field_Label&"','"&Field_Help&"','"&Field_Type&"','"&Field_Option&"');"&vbCrLf)
		End IF
	Next
	Response.Write("</script>")
%>
	<p id="FieldList">&nbsp;</p>
	<table width="90%" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
	    <tr>
	        <td height="30" width="15%" align="right">名称：</td>
	        <td width="85%">&nbsp;<input name="Field_Name" type="text" class="input" id="Field_Name" size="40" /><span class="help" title="<p>自定义字段名称，请输入1-50个字符（两个字符为一个汉字）。</p>"></span></td>
	    </tr>
	    <tr>
	        <td height="30" align="right">备注：</td>
	        <td>&nbsp;<input name="Field_Remark" type="text" class="input" id="Field_Remark" size="40" /><span class="help" title="<p>用于识别自定义字段的用途，此段文字仅显示在自定义字段列表上，请输入1-255个字符（两个字符为一个汉字）。</p>"></span></td>
	    </tr>
        <tr>
            <td height="30" align="right">字段标识：</td>
            <td>&nbsp;<input name="Field_Label" type="text" class="input" id="Field_Label" size="20" /><span class="help" title="<p>自定义字段标识，配置后请尽量不要修改，请输入字母或数字，请输入1-50个字符。</p>"></span></td>
        </tr>
	    <tr>
	        <td height="30" align="right">帮助语句：</td>
	        <td>&nbsp;<input name="Field_Help" type="text" class="input" id="Field_Help" size="40" /><span class="help" title="<p>帮助语句，显示在输入框边上，请输入1-255个字符（两个字符为一个汉字）。</p>"></span></td>
	    </tr>
        <tr>
            <td height="30" align="right">输入类型：</td>
            <td>&nbsp;<select name="Field_Type" class="input" id="Field_Type" onchange="if($(this).val()==3){$('#Option').show();}else{$('#Option').hide();}">
                    <option value="0">文本框</option>
                    <option value="1">编辑器框</option>
                    <option value="2">上传框</option>
                    <option value="3">下拉框</option>
            </select><span class="help" title="<p>选择输入类型。</p>"></span></td>
        </tr>
        <tr id="Option" class="dis">
            <td height="30" align="right">选项：</td>
            <td>&nbsp;<textarea name="Field_Option" class="textarea" cols="60" rows="5" id="Field_Option"></textarea><span class="help" title="<p>选项每行一个：选项值||选项字符串。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">&nbsp;</td>
            <td>&nbsp;<input type="button" class="button" name="btn1" id="btn1" value="增加字段" onclick="AddField();" /></td>
        </tr>
	</table>
</div>
<div id="bottom">
	<input type="hidden" name="Id" value="<%=Id%>" />
	<input type="submit" class="button" name="Enter" id="Enter" value="修 改" />
	<input type="button" onclick="dialogClose();" class="button" name="button" id="button" value="关 闭" />
</div>
</form>
<%
End Sub

'==============================
'函 数 名：ModelEditDo
'作    用：执行修改内容模型
'==============================
Sub ModelEditDo()
	Fk_Model_Name=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_Name")))
	Fk_Model_ViewName=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_ViewName")))
	Fk_Model_Template=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_Template")))
	Fk_Model_LowTemplate=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_LowTemplate")))
	Fk_Model_Default=FKFun.HTMLEncode(Replace(Trim(Request.Form("Fk_Model_Default"))," ",""))
	Fk_Model_Field=FKFun.HTMLEncode(Replace(Trim(Request.Form("Fk_Model_Field")),", ",""))
	Fk_Model_Type=Trim(Request.Form("Fk_Model_Type"))
	Fk_Model_State=Trim(Request.Form("Fk_Model_State"))
	Fk_Model_Field=Replace(Fk_Model_Field,"<br />","|-|")
	Id=Trim(Request.Form("Id"))
	Call FKFun.JsonString(Fk_Model_Name,1,50,0,"请输入名称！","名称不能大于50个字符！")
	Call FKFun.JsonNum(Fk_Model_Type,"请选择模型类型！")
	Call FKFun.JsonNum(Fk_Model_State,"请选择是否可用！")
	Call FKFun.JsonNum(Id,"系统参数错误，请刷新页面！")
	If Instr("2",Fk_Model_Type)>0 Then
		Fk_Model_ViewName="-"
		Fk_Model_Default=",,"
	End If
	Fk_Model_Default=","&Fk_Model_Default&","
	Sqlstr="Select Fk_Model_Id,Fk_Model_Name,Fk_Model_ViewName,Fk_Model_Type,Fk_Model_Template,Fk_Model_LowTemplate,Fk_Model_Default,Fk_Model_Field,Fk_Model_State From [Fk_Model] Where Fk_Model_Id=" & Id
	Rs.Open Sqlstr,Conn,1,3
	If Not Rs.Eof Then
		Application.Lock()
		Rs("Fk_Model_Name")=Fk_Model_Name
		Rs("Fk_Model_ViewName")=Fk_Model_ViewName
		Rs("Fk_Model_Type")=Fk_Model_Type
		Rs("Fk_Model_Template")=Fk_Model_Template
		Rs("Fk_Model_LowTemplate")=Fk_Model_LowTemplate
		Rs("Fk_Model_Default")=Fk_Model_Default
		Rs("Fk_Model_Field")=Fk_Model_Field
		Rs("Fk_Model_State")=Fk_Model_State
		Rs.Update()
		Application.UnLock()
		Call FKFun.JsonSuccess()
	Else
		Rs.Close
		Call FKFun.JsonError("要修改的模型不存在！")
	End If
	Rs.Close
End Sub

'==============================
'函 数 名：ModelDelDo
'作    用：执行删除模型
'==============================
Sub ModelDelDo()
	Id=Trim(Request.QueryString("Id"))
	Call FKFun.ShowNum(Id,"系统参数错误，请刷新页面！")
	Sqlstr="Select Fk_Module_Id From [Fk_Module] Where Fk_Module_Model=" & Id
	Rs.Open Sqlstr,Conn,1,1
	If Not Rs.Eof Then
		Call FKFun.ShowErr("该模型在使用中，无法删除！",2)
	End If
	Rs.Close
	Sqlstr="Select Fk_Model_Id From [Fk_Model] Where Fk_Model_Id=" & Id
	Rs.Open Sqlstr,Conn,1,3
	If Not Rs.Eof Then
		Application.Lock()
		Rs.Delete()
		Application.UnLock()
		Response.Write("ok")
	Else
		Response.Write("要删除的模型不存在！")
	End If
	Rs.Close
End Sub

'==============================
'函 数 名：ModelCopyDo
'作    用：执行复制模型
'==============================
Sub ModelCopyDo()
	Id=Trim(Request.QueryString("Id"))
	Call FKFun.ShowNum(Id,"系统参数错误，请刷新页面！")
	Sqlstr="Select Fk_Model_Name,Fk_Model_ViewName,Fk_Model_Type,Fk_Model_Default,Fk_Model_Field,Fk_Model_State From [Fk_Model] Where Fk_Model_Id=" & Id
	Rs.Open Sqlstr,Conn,1,1
	If Not Rs.Eof Then
		Sqlstr="Insert Into [Fk_Model](Fk_Model_Name,Fk_Model_ViewName,Fk_Model_Type,Fk_Model_Default,Fk_Model_Field,Fk_Model_State) Values('"&Rs("Fk_Model_Name")&" 复制','"&Rs("Fk_Model_ViewName")&"',"&Rs("Fk_Model_Type")&",'"&Rs("Fk_Model_Default")&"','"&Rs("Fk_Model_Field")&"',"&Rs("Fk_Model_State")&")"
		Application.Lock()
		Conn.Execute(Sqlstr)
		Application.UnLock()
	End If
	Rs.Close
	Response.Write("ok")
End Sub

'======================留言模型=============================================================

'==========================================
'函 数 名：GBookModelAddForm()
'作    用：添加留言模型表单
'==========================================
Sub GBookModelAddForm()
%>
<form id="ModelAdd" name="ModelAdd" method="post" target="ajax" action="Model.asp?Type=13" showStr="新模型添加成功！" refreshUrl="Model.asp?Type=1" boxClose="1">
<div id="title">添加新留言模型</div>
<div id="box">
	<table width="90%" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td width="15%" height="30" align="right">名称：</td>
			<td width="85%">&nbsp;<input name="Fk_Model_Name" type="text" class="input" id="Fk_Model_Name" size="40" /><span class="help" title="<p>模型名称，请输入1-50个字符（两个字符为一个汉字）。</p>"></span></td>
		</tr>
		<tr>
			<td height="30" align="right">成功留言转向：</td>
			<td>&nbsp;<input name="Fk_Model_GoUrl" type="text" class="input" id="Fk_Model_GoUrl" size="40" /><span class="help" title="<p>留言成功后转向的链接。</p>"></span></td>
		</tr>
		<tr>
			<td height="30" align="right">留言成功提示：</td>
			<td>&nbsp;<input name="Fk_Model_Succeed" type="text" class="input" id="Fk_Model_Succeed" value="留言成功，我们会尽快回复！" size="40" /><span class="help" title="<p>留言成功提示，请输入1-255个字符（1个汉字为2个字符）。</p>"></span></td>
		</tr>
		<tr>
			<td height="30" align="right">重复留言提示：</td>
			<td>&nbsp;<input name="Fk_Model_Repeat" type="text" class="input" id="Fk_Model_Repeat" value="请勿重复留言！" size="40" /><span class="help" title="<p>重复留言提示，请输入1-255个字符（1个汉字为2个字符）。</p>"></span></td>
		</tr>
		<tr>
			<td height="30" align="right">反垃圾留言：</td>
			<td>
            	&nbsp;<input type="radio" name="Fk_Model_NoTrash" class="Input" id="Fk_Model_NoTrash" value="0" />关闭
            	&nbsp;<input type="radio" name="Fk_Model_NoTrash" class="Input" id="Fk_Model_NoTrash" value="1" />开启
            	&nbsp;<input type="radio" name="Fk_Model_NoTrash" class="Input" id="Fk_Model_NoTrash" value="2" checked="checked" />部分开启
            	<span class="help" title="<p>此功能开启时，对留言进行中文字数占有量和链接个数进行判断，如果中文字数过低或者链接过多（超过2个），则认为是垃圾留言，如果英文站，请选择关闭或者部分开启，部分开启是不判断中文字数，只判断链接个数。</p>"></span>
            </td>
		</tr>
		<tr>
			<td height="30" align="right">垃圾留言提示：</td>
			<td>&nbsp;<input name="Fk_Model_TrashPint" type="text" class="input" id="Fk_Model_TrashPint" value="请勿发垃圾信息！" size="40" /><span class="help" title="<p>垃圾留言提示，请输入1-255个字符（1个汉字为2个字符）。</p>"></span></td>
		</tr>
		<tr>
			<td height="30" align="right">字符串过短提示：</td>
			<td>&nbsp;<input name="Fk_Model_MinStr" type="text" class="input" id="Fk_Model_MinStr" value="请输入{$留言条目$}！" size="40" /><span class="help" title="<p>字符串过短提示，{$留言条目$}:留言条目，{$留言长度$}：限制长度，请输入1-255个字符（1个汉字为2个字符）。</p>"></span></td>
		</tr>
		<tr>
			<td height="30" align="right">字符串过长提示：</td>
			<td>&nbsp;<input name="Fk_Model_MaxStr" type="text" class="input" id="Fk_Model_MaxStr" value="{$留言条目$}不能大于{$留言长度$}个字符！" size="40" /><span class="help" title="<p>字符串过长提示，{$留言条目$}:留言条目，{$留言长度$}：限制长度，请输入1-255个字符（1个汉字为2个字符）。</p>"></span></td>
		</tr>
		<tr>
			<td height="30" align="right">留言验证码：</td>
			<td>
            	&nbsp;<input type="radio" name="Fk_Model_Captchas" class="Input" id="Fk_Model_Captchas" value="0" />关闭
            	&nbsp;<input type="radio" name="Fk_Model_Captchas" class="Input" id="Fk_Model_Captchas" value="1" checked="checked" />开启
            	<span class="help" title="<p>开启验证码，请在表单中加入验证码相应调用。</p>"></span>
            </td>
		</tr>
	</table>
	<script type="text/javascript">
	AddGBookField_Show('留言标题','GBook_Title','1','50',1,0);
	</script>
	<p id="FieldList">&nbsp;</p>
	<table width="90%" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
	    <tr>
	        <td height="30" width="15%" align="right">名称：</td>
	        <td width="85%">&nbsp;<input name="Field_Name" type="text" class="input" id="Field_Name" size="40" /><span class="help" title="<p>自定义字段名称，请输入1-50个字符（两个字符为一个汉字）。</p>"></span></td>
	    </tr>
        <tr>
            <td height="30" align="right">表单标识：</td>
            <td>&nbsp;<input name="Field_Label" type="text" class="input" id="Field_Label" size="20" value="GBook_" />*输入字母或数字，添加后不可修改<span class="help" title="<p>自定义字段标签，请输入字母或数字，请输入1-50个字符。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">字符长度：</td>
            <td>&nbsp;<input name="Field_StrMin" type="text" class="input" id="Field_StrMin" size="20" value="1" /> 至 <input name="Field_StrMax" type="text" class="input" id="Field_StrMax" size="20" value="50" /><span class="help" title="<p>限制最短及最长长度。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">后台列表显示：</td>
            <td>&nbsp;<input type="checkbox" name="Field_ListShow" class="input" id="Field_ListShow" value="1" /><span class="help" title="<p>选择是否后台列表显示。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">&nbsp;</td>
            <td>&nbsp;<input type="button" class="button" name="btn1" id="btn1" value="增加字段" onclick="AddGBookField();" /></td>
        </tr>
	</table>
</div>
<div id="bottom">
	<input type="submit" class="button" name="Enter" id="Enter" value="添 加" />
	<input type="button" onclick="dialogClose();" class="button" name="button" id="button" value="关 闭" />
</div>
</form>
<%
End Sub

'==============================
'函 数 名：GBookModelAddDo
'作    用：执行添加留言模型
'==============================
Sub GBookModelAddDo()
	Fk_Model_Name=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_Name")))
	Fk_Model_GoUrl=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_GoUrl")))
	Fk_Model_Succeed=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_Succeed")))
	Fk_Model_Repeat=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_Repeat")))
	Fk_Model_TrashPint=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_TrashPint")))
	Fk_Model_MinStr=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_MinStr")))
	Fk_Model_MaxStr=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_MaxStr")))
	Fk_Model_Field=FKFun.HTMLEncode(Replace(Trim(Request.Form("Fk_Model_Field")),", ",""))
	Fk_Model_NoTrash=Trim(Request.Form("Fk_Model_NoTrash"))
	Fk_Model_Captchas=Trim(Request.Form("Fk_Model_Captchas"))
	Fk_Model_State=1
	Call FKFun.JsonString(Fk_Model_Name,1,50,0,"请输入名称！","名称不能大于50个字符！")
	Call FKFun.JsonString(Fk_Model_GoUrl,1,255,0,"请输入成功留言转向！","成功留言转向不能大于255个字符！")
	Call FKFun.JsonString(Fk_Model_Succeed,1,255,0,"请输入留言成功提示！","留言成功提示不能大于255个字符！")
	Call FKFun.JsonString(Fk_Model_Repeat,1,255,0,"请输入重复留言提示！","重复留言提示不能大于255个字符！")
	Call FKFun.JsonString(Fk_Model_NoTrash,1,255,0,"请输入垃圾留言提示！","垃圾留言提示不能大于255个字符！")
	Call FKFun.JsonString(Fk_Model_MinStr,1,255,0,"请输入字符串过短提示！","字符串过短提示不能大于255个字符！")
	Call FKFun.JsonString(Fk_Model_MaxStr,1,255,0,"请输入字符串过长提示！","字符串过长提示不能大于255个字符！")
	Call FKFun.JsonNum(Fk_Model_NoTrash,"请选择是否开启反垃圾留言！")
	Call FKFun.JsonNum(Fk_Model_Captchas,"请选择是否开启验证码！")
	Call FKFun.JsonNum(Fk_Model_State,"请选择是否可用！")
	Fk_Model_ViewName="-"
	Fk_Model_Default=",,"
	Fk_Model_Type=3
	Fk_Model_Field="Field_GoUrl:"&Fk_Model_GoUrl&"|;|Field_Succeed:"&Fk_Model_Succeed&"|;|Field_Repeat:"&Fk_Model_Repeat&"|;|Field_NoTrash:"&Fk_Model_NoTrash&"|;|Field_TrashPint:"&Fk_Model_TrashPint&"|;|Field_MinStr:"&Fk_Model_MinStr&"|;|Field_MaxStr:"&Fk_Model_MaxStr&"|;|Field_Captchas:"&Fk_Model_Captchas&"|;||GModelOption|"&Fk_Model_Field
	Sqlstr="Select Fk_Model_Id,Fk_Model_Name,Fk_Model_ViewName,Fk_Model_Type,Fk_Model_Default,Fk_Model_Field,Fk_Model_State From [Fk_Model] Where Fk_Model_Name='"&Fk_Model_Name&"'"
	Rs.Open Sqlstr,Conn,1,3
	If Rs.Eof Then
		Application.Lock()
		Rs.AddNew()
		Rs("Fk_Model_Name")=Fk_Model_Name
		Rs("Fk_Model_ViewName")=Fk_Model_ViewName
		Rs("Fk_Model_Type")=Fk_Model_Type
		Rs("Fk_Model_Default")=Fk_Model_Default
		Rs("Fk_Model_Field")=Fk_Model_Field
		Rs("Fk_Model_State")=Fk_Model_State
		Rs.Update()
		Application.UnLock()
		Call FKFun.JsonSuccess()
	Else
		Rs.Close
		Call FKFun.JsonError("该模型名称已经被占用！")
	End If
	Rs.Close
End Sub

'==========================================
'函 数 名：GBookModelEditForm()
'作    用：修改留言模型表单
'==========================================
Sub GBookModelEditForm()
	Id=Clng(Request.QueryString("Id"))
	Sqlstr="Select Fk_Model_Name,Fk_Model_ViewName,Fk_Model_Type,Fk_Model_Default,Fk_Model_Field,Fk_Model_State From [Fk_Model] Where Fk_Model_Id=" & Id
	Rs.Open Sqlstr,Conn,1,1
	If Not Rs.Eof Then
		Fk_Model_Name=Rs("Fk_Model_Name")
		Fk_Model_ViewName=Rs("Fk_Model_ViewName")
		Fk_Model_Type=Rs("Fk_Model_Type")
		Fk_Model_Default=Rs("Fk_Model_Default")
		Fk_Model_Field=Rs("Fk_Model_Field")
		Fk_Model_State=Rs("Fk_Model_State")
		If IsNull(Fk_Model_Field) Then
			Fk_Model_Field=""
		End If
		Fk_Model_Field=Replace(Fk_Model_Field,"|FieldList|,","|FieldList|")
	Else
		Rs.Close
		Call FKFun.ShowErr("模型不存在！",1)
	End If
	Rs.Close
	Fk_Model_GoUrl=FKFun.GetSub(Fk_Model_Field,"Field_GoUrl:","|;|","")
	Fk_Model_Succeed=FKFun.GetSub(Fk_Model_Field,"Field_Succeed:","|;|","")
	Fk_Model_Repeat=FKFun.GetSub(Fk_Model_Field,"Field_Repeat:","|;|","")
	Fk_Model_NoTrash=Clng(FKFun.GetSub(Fk_Model_Field,"Field_NoTrash:","|;|",""))
	Fk_Model_TrashPint=FKFun.GetSub(Fk_Model_Field,"Field_TrashPint:","|;|","")
	Fk_Model_MinStr=FKFun.GetSub(Fk_Model_Field,"Field_MinStr:","|;|","")
	Fk_Model_MaxStr=FKFun.GetSub(Fk_Model_Field,"Field_MaxStr:","|;|","")
	Fk_Model_Captchas=FKFun.GetSub(Fk_Model_Field,"Field_Captchas:","|;|","1")
%>
<form id="ModelEdit" name="ModelEdit" method="post" target="ajax" action="Model.asp?Type=15" showStr="模型修改成功！" refreshUrl="Model.asp?Type=1" boxClose="1">
<div id="title">修改留言模型</div>
<div id="box">
	<table width="90%" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td width="15%" height="30" align="right">名称：</td>
			<td width="85%">&nbsp;<input name="Fk_Model_Name" type="text" class="input" id="Fk_Model_Name" value="<%=Fk_Model_Name%>" size="40" /><span class="help" title="<p>模型名称，请输入1-50个字符（两个字符为一个汉字）。</p>"></span></td>
		</tr>
		<tr>
			<td height="30" align="right">成功留言转向：</td>
			<td>&nbsp;<input name="Fk_Model_GoUrl" type="text" class="input" id="Fk_Model_GoUrl" value="<%=Fk_Model_GoUrl%>" size="40" /><span class="help" title="<p>留言成功后转向的链接。</p>"></span></td>
		</tr>
		<tr>
			<td height="30" align="right">留言成功提示：</td>
			<td>&nbsp;<input name="Fk_Model_Succeed" type="text" class="input" id="Fk_Model_Succeed" value="<%=Fk_Model_Succeed%>" size="40" /><span class="help" title="<p>留言成功提示，请输入1-255个字符（1个汉字为2个字符）。</p>"></span></td>
		</tr>
		<tr>
			<td height="30" align="right">重复留言提示：</td>
			<td>&nbsp;<input name="Fk_Model_Repeat" type="text" class="input" id="Fk_Model_Repeat" value="<%=Fk_Model_Repeat%>" size="40" /><span class="help" title="<p>重复留言提示，请输入1-255个字符（1个汉字为2个字符）。</p>"></span></td>
		</tr>
		<tr>
			<td height="30" align="right">反垃圾留言：</td>
			<td>
            	&nbsp;<input type="radio" name="Fk_Model_NoTrash" class="Input" id="Fk_Model_NoTrash" value="0"<%=FKFun.BeCheck(Fk_Model_NoTrash,0)%> />关闭
            	&nbsp;<input type="radio" name="Fk_Model_NoTrash" class="Input" id="Fk_Model_NoTrash" value="1"<%=FKFun.BeCheck(Fk_Model_NoTrash,1)%> />开启
            	&nbsp;<input type="radio" name="Fk_Model_NoTrash" class="Input" id="Fk_Model_NoTrash" value="2"<%=FKFun.BeCheck(Fk_Model_NoTrash,2)%> />部分开启
            	<span class="help" title="<p>此功能开启时，对留言进行中文字数占有量和链接个数进行判断，如果中文字数过低或者链接过多（超过2个），则认为是垃圾留言，如果英文站，请选择关闭或者部分开启，部分开启是不判断中文字数，只判断链接个数。</p>"></span>
            </td>
		</tr>
		<tr>
			<td height="30" align="right">垃圾留言提示：</td>
			<td>&nbsp;<input name="Fk_Model_TrashPint" type="text" class="input" id="Fk_Model_TrashPint" value="<%=Fk_Model_TrashPint%>" size="40" /><span class="help" title="<p>垃圾留言提示，请输入1-255个字符（1个汉字为2个字符）。</p>"></span></td>
		</tr>
		<tr>
			<td height="30" align="right">字符串过短提示：</td>
			<td>&nbsp;<input name="Fk_Model_MinStr" type="text" class="input" id="Fk_Model_MinStr" value="<%=Fk_Model_MinStr%>" size="40" /><span class="help" title="<p>字符串过短提示，{$留言条目$}:留言条目，{$留言长度$}：限制长度，请输入1-255个字符（1个汉字为2个字符）。</p>"></span></td>
		</tr>
		<tr>
			<td height="30" align="right">字符串过长提示：</td>
			<td>&nbsp;<input name="Fk_Model_MaxStr" type="text" class="input" id="Fk_Model_MaxStr" value="<%=Fk_Model_MaxStr%>" size="40" /><span class="help" title="<p>字符串过长提示，{$留言条目$}:留言条目，{$留言长度$}：限制长度，请输入1-255个字符（1个汉字为2个字符）。</p>"></span></td>
		</tr>
		<tr>
			<td height="30" align="right">留言验证码：</td>
			<td>
            	&nbsp;<input type="radio" name="Fk_Model_Captchas" class="Input" id="Fk_Model_Captchas" value="0"<%=FKFun.BeCheck(Fk_Model_Captchas,0)%> />关闭
            	&nbsp;<input type="radio" name="Fk_Model_Captchas" class="Input" id="Fk_Model_Captchas" value="1"<%=FKFun.BeCheck(Fk_Model_Captchas,1)%> />开启
            	<span class="help" title="<p>开启验证码，请在表单中加入验证码相应调用。</p>"></span>
            </td>
		</tr>
	</table>
<%
	i=0
	TempArr=Split(Split(Fk_Model_Field,"|GModelOption|")(1),"|FieldList|")
	Response.Write("<script type=""text/javascript"">")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Name=FKFun.GetSub(Temp,"Field_Name:","|;|","")
			Field_Label=FKFun.GetSub(Temp,"Field_Label:","|;|","")
			Field_StrMin=FKFun.GetSub(Temp,"Field_StrMin:","|;|","")
			Field_StrMax=FKFun.GetSub(Temp,"Field_StrMax:","|;|","")
			Field_ListShow=FKFun.GetSub(Temp,"Field_ListShow:","|;|","0")
			If i=0 Then
				Field_ListShow="1"
			End If
			Response.Write("AddGBookField_Show('"&Field_Name&"','"&Field_Label&"','"&Field_StrMin&"','"&Field_StrMax&"',"&Field_ListShow&","&i&");"&vbCrLf)
			i=1
		End IF
	Next
	Response.Write("</script>")
%>
	<p id="FieldList">&nbsp;</p>
	<table width="90%" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
	    <tr>
	        <td height="30" width="15%" align="right">名称：</td>
	        <td width="85%">&nbsp;<input name="Field_Name" type="text" class="input" id="Field_Name" size="40" /><span class="help" title="<p>自定义字段名称，请输入1-50个字符（两个字符为一个汉字）。</p>"></span></td>
	    </tr>
        <tr>
            <td height="30" align="right">表单标识：</td>
            <td>&nbsp;<input name="Field_Label" type="text" class="input" id="Field_Label" size="20" value="GBook_" />*输入字母或数字，添加后不可修改<span class="help" title="<p>自定义字段标签，请输入字母或数字，请输入1-50个字符。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">字符长度：</td>
            <td>&nbsp;<input name="Field_StrMin" type="text" class="input" id="Field_StrMin" size="20" value="1" /> 至 <input name="Field_StrMax" type="text" class="input" id="Field_StrMax" size="20" value="50" /><span class="help" title="<p>限制最短及最长长度。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">后台列表显示：</td>
            <td>&nbsp;<input type="checkbox" name="Field_ListShow" class="input" id="Field_ListShow" value="1" /><span class="help" title="<p>选择是否后台列表显示。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">&nbsp;</td>
            <td>&nbsp;<input type="button" class="button" name="btn1" id="btn1" value="增加字段" onclick="AddGBookField();" /></td>
        </tr>
	</table>
</div>
<div id="bottom">
	<input type="hidden" name="Id" value="<%=Id%>" />
	<input type="submit" class="button" name="Enter" id="Enter" value="修 改" />
	<input type="button" onclick="dialogClose();" class="button" name="button" id="button" value="关 闭" />
</div>
</form>
<%
End Sub

'==============================
'函 数 名：GBookModelEditDo
'作    用：执行修改留言模型
'==============================
Sub GBookModelEditDo()
	Fk_Model_Name=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_Name")))
	Fk_Model_GoUrl=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_GoUrl")))
	Fk_Model_Succeed=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_Succeed")))
	Fk_Model_Repeat=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_Repeat")))
	Fk_Model_TrashPint=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_TrashPint")))
	Fk_Model_MinStr=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_MinStr")))
	Fk_Model_MaxStr=FKFun.HTMLEncode(Trim(Request.Form("Fk_Model_MaxStr")))
	Fk_Model_Field=FKFun.HTMLEncode(Replace(Trim(Request.Form("Fk_Model_Field")),", ",""))
	Fk_Model_NoTrash=Trim(Request.Form("Fk_Model_NoTrash"))
	Fk_Model_Captchas=Trim(Request.Form("Fk_Model_Captchas"))
	Fk_Model_State=1
	Id=Trim(Request.Form("Id"))
	Call FKFun.JsonString(Fk_Model_Name,1,50,0,"请输入名称！","名称不能大于50个字符！")
	Call FKFun.JsonString(Fk_Model_GoUrl,1,255,0,"请输入成功留言转向！","成功留言转向不能大于255个字符！")
	Call FKFun.JsonString(Fk_Model_Succeed,1,255,0,"请输入留言成功提示！","留言成功提示不能大于255个字符！")
	Call FKFun.JsonString(Fk_Model_Repeat,1,255,0,"请输入重复留言提示！","重复留言提示不能大于255个字符！")
	Call FKFun.JsonString(Fk_Model_NoTrash,1,255,0,"请输入垃圾留言提示！","垃圾留言提示不能大于255个字符！")
	Call FKFun.JsonString(Fk_Model_MinStr,1,255,0,"请输入字符串过短提示！","字符串过短提示不能大于255个字符！")
	Call FKFun.JsonString(Fk_Model_MaxStr,1,255,0,"请输入字符串过长提示！","字符串过长提示不能大于255个字符！")
	Call FKFun.JsonNum(Fk_Model_NoTrash,"请选择是否开启反垃圾留言！")
	Call FKFun.JsonNum(Fk_Model_Captchas,"请选择是否开启验证码！")
	Call FKFun.JsonNum(Fk_Model_State,"请选择是否可用！")
	Call FKFun.JsonNum(Id,"系统参数错误，请刷新页面！")
	Fk_Model_ViewName="-"
	Fk_Model_Default=",,"
	Fk_Model_Type=3
	Fk_Model_Field="Field_GoUrl:"&Fk_Model_GoUrl&"|;|Field_Succeed:"&Fk_Model_Succeed&"|;|Field_Repeat:"&Fk_Model_Repeat&"|;|Field_NoTrash:"&Fk_Model_NoTrash&"|;|Field_TrashPint:"&Fk_Model_TrashPint&"|;|Field_MinStr:"&Fk_Model_MinStr&"|;|Field_MaxStr:"&Fk_Model_MaxStr&"|;|Field_Captchas:"&Fk_Model_Captchas&"|;||GModelOption|"&Fk_Model_Field
	Sqlstr="Select Fk_Model_Id,Fk_Model_Name,Fk_Model_ViewName,Fk_Model_Type,Fk_Model_Default,Fk_Model_Field,Fk_Model_State From [Fk_Model] Where Fk_Model_Id=" & Id
	Rs.Open Sqlstr,Conn,1,3
	If Not Rs.Eof Then
		Application.Lock()
		Rs("Fk_Model_Name")=Fk_Model_Name
		Rs("Fk_Model_ViewName")=Fk_Model_ViewName
		Rs("Fk_Model_Type")=Fk_Model_Type
		Rs("Fk_Model_Default")=Fk_Model_Default
		Rs("Fk_Model_Field")=Fk_Model_Field
		Rs("Fk_Model_State")=Fk_Model_State
		Rs.Update()
		Application.UnLock()
		Call FKFun.JsonSuccess()
	Else
		Rs.Close
		Call FKFun.JsonError("要修改的模型不存在！")
	End If
	Rs.Close
End Sub

Call FKFun.PageEnd()
%>
